package com.cqhilink.iot.jobstandardmanagement.services.innerservice.impl.permission;

import com.cqhilink.iot.jobstandardmanagement.dao.mapper.AccountMapper;
import com.cqhilink.iot.jobstandardmanagement.facade.model.Account;
import com.cqhilink.iot.jobstandardmanagement.facade.service.permission.JsmAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by huangxueqian on 2017/1/4/004.
 */

public class JsmAccountServiceImpl implements JsmAccountService {
    @Autowired
    private AccountMapper accountMapper;

    /**
     * @param username 用户名称
     * @param password 用户密码
     * @param token
     * @return
     * @throws Exception
     */
    @Override
    public Account login(String username, String password, String token) throws Exception {
        Map map = new HashMap<>();
        map.put("username", username);
        map.put("password", password);
        Account account = accountMapper.login(map);
        // 判断token 问题 ;
        return account;
    }

    /**
     * @param accountId 账号ID
     * @return 返回账户信息
     * @throws Exception
     */
    @Override
    public Account selectAcountByAccountId(String accountId) throws Exception {

        return accountMapper.selectByPrimaryKey(accountId);
    }
}
